In [1]:
import time
import os
import sys
import numpy as np
import matplotlib
matplotlib.use('nbagg')
#from matplotlib import style
#style.use('ggplot')
import matplotlib.pyplot as plt
import astropy.units as u
from astropy import stats
from astropy.io import fits
from mmtwfs.wfs import *
from mmtwfs.zernike import ZernikeVector
from mmtwfs.telescope import MMT
%cd /Users/tim/MMT/wfsdat/binospec/2017.1113
foc_trans = 40.8 * u.nm / u.um
cc_trans = 24.97 * u.um / u.arcsec
In [2]:
%load_ext autoreload
%autoreload 2
In [3]:
# first set
baseline_1 = [
"wfs_ff_cal_img_2017.1113.111402.fits",
"wfs_ff_cal_img_2017.1113.111425.fits",
"wfs_ff_cal_img_2017.1113.111448.fits"
]
# second set
baseline_2 = [
"wfs_ff_cal_img_2017.1113.112547.fits",
"wfs_ff_cal_img_2017.1113.112610.fits",
"wfs_ff_cal_img_2017.1113.112634.fits",
"wfs_ff_cal_img_2017.1113.112657.fits"
]
b1_zerns = []
b2_zerns = []
for f in baseline_1:
zfile = f"{f}.rot.zernikes"
b1_zerns.append(ZernikeVector(coeffs=zfile))
for f in baseline_2:
zfile = f"{f}.rot.zernikes"
b2_zerns.append(ZernikeVector(coeffs=zfile))
# calculate the averages
b1_ave = ZernikeVector()
b2_ave = ZernikeVector()
for z in b1_zerns:
b1_ave += z
b1_ave /= len(b1_zerns)
for z in b2_zerns:
b2_ave += z
b2_ave /= len(b2_zerns)
In [4]:
sub = b1_zerns[0] - b1_ave
print(sub)
sub.fringe_bar_chart().show()
Looks like there's some variation. Let's calculate the RMS scatter of the baseline measurements.
In [5]:
b1_rms = ZernikeVector()
for z in b1_zerns:
b1_rms += (z - b1_ave)**2
b1_rms = b1_rms**0.5
b2_rms = ZernikeVector()
for z in b2_zerns:
b2_rms += (z - b2_ave)**2
b2_rms = b1_rms**0.5
In [6]:
b1_rms.bar_chart().show()
In [7]:
b2_rms.bar_chart().show()
In [8]:
print(f"Set 1 focus RMS: {b1_rms['Z04'] / foc_trans}, Set 2 focus RMS: {b2_rms['Z04'] / foc_trans}")
Some clear drift in some terms, especially defocus and astig 45. These could be due to changes in temperature, especially in the primary. However, there's variation just within the first three so it could also be changes due to seeing.
In [9]:
b1_sub = b2_ave - b1_ave
b1_sub.fringe_bar_chart().show()
b1_sub['Z04'] / foc_trans
Out[9]:
In [10]:
foc_nominal = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.110503.fits.rot.zernikes")
In [15]:
foc1 = foc_nominal - b1_ave
foc1.fringe_bar_chart().show()
In [16]:
foc_p100 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.110550.fits.rot.zernikes") - foc_nominal
foc_m100 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.110700.fits.rot.zernikes") - foc_nominal
foc_m50 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.110724.fits.rot.zernikes") - foc_nominal
foc_p50 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.110810.fits.rot.zernikes") - foc_nominal
In [17]:
foc_p100['Z04'] / foc_trans
Out[17]:
In [18]:
foc_m100['Z04'] / foc_trans
Out[18]:
In [19]:
foc_m50['Z04'] / foc_trans
Out[19]:
In [20]:
foc_p50['Z04'] / foc_trans
Out[20]:
In [26]:
foc_p100.fringe_bar_chart().show()
Looks like large focus changes also result in increases in the other spherical terms...
In [28]:
astig0_p500 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.111559.fits.rot.zernikes") - b2_ave
astig0_m500 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.111709.fits.rot.zernikes") - b2_ave
astig0_m1000 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.111843.fits.rot.zernikes") - b2_ave
astig0_p1000 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.111954.fits.rot.zernikes") - b2_ave
astig45_p500 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.112104.fits.rot.zernikes") - b2_ave
astig45_p1000 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.112215.fits.rot.zernikes") - b2_ave
astig45_m500 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.112350.fits.rot.zernikes") - b2_ave
astig45_m1000 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.112500.fits.rot.zernikes") - b2_ave
trefx_p500 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.112807.fits.rot.zernikes") - b2_ave
trefx_m500 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.112854.fits.rot.zernikes") - b2_ave
trefy_p500 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.113004.fits.rot.zernikes") - b2_ave
trefy_m500 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.113051.fits.rot.zernikes") - b2_ave
spher_p500 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.113201.fits.rot.zernikes") - b2_ave
spher_m500 = ZernikeVector(coeffs="wfs_ff_cal_img_2017.1113.113311.fits.rot.zernikes") - b2_ave
In [39]:
astig45_p500['Z05']
Out[39]:
In [43]:
trefy_p500
Out[43]:
In [46]:
spher_p500['Z11']
Out[46]:
In [ ]: